home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / HTMLRendering.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  10.9 KB  |  387 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        HTMLRendering.h
  3.  
  4.      Contains:    HTML Rendering Library Interfaces.
  5.  
  6.      Version:    Technology:    1.0
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __HTMLRENDERING__
  18. #define __HTMLRENDERING__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __QUICKDRAW__
  25.     #include <Quickdraw.h>
  26. #endif
  27.  
  28. #ifndef __EVENTS__
  29.     #include <Events.h>
  30. #endif
  31.  
  32. #ifndef __FILES__
  33.     #include <Files.h>
  34. #endif
  35.  
  36. #ifndef __CODEFRAGMENTS__
  37.     #include <CodeFragments.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. typedef struct OpaqueHRReference*         HRReference;
  64. EXTERN_API( OSStatus )
  65. HRGetHTMLRenderingLibVersion    (NumVersion *            returnVers);
  66.  
  67. #if TARGET_RT_MAC_CFM
  68. #if CALL_NOT_IN_CARBON
  69. #ifdef __cplusplus
  70.     inline pascal Boolean HRHTMLRenderingLibAvailable() { return ((HRGetHTMLRenderingLibVersion != (void*)kUnresolvedCFragSymbolAddress) ); }
  71. #else
  72.     #define HRHTMLRenderingLibAvailable()     ((HRGetHTMLRenderingLibVersion != (void*)kUnresolvedCFragSymbolAddress) )
  73. #endif
  74. #endif
  75. #elif TARGET_RT_MAC_MACHO
  76. /* HTML Rendering is currently not available on OS X */
  77. #if CALL_NOT_IN_CARBON
  78. #ifdef __cplusplus
  79.     inline pascal Boolean HRHTMLRenderingLibAvailable() { return false; }
  80. #else
  81.     #define HRHTMLRenderingLibAvailable()     (false)
  82. #endif
  83. #endif
  84. #endif  /*  */
  85.  
  86. enum {
  87.     kHRRendererHTML32Type        = FOUR_CHAR_CODE('ht32')        /* HTML 3.2 */
  88. };
  89.  
  90.  
  91. EXTERN_API( OSStatus )
  92. HRNewReference                    (HRReference *            hrRef,
  93.                                  OSType                 rendererType,
  94.                                  GrafPtr                 grafPtr);
  95.  
  96. EXTERN_API( OSStatus )
  97. HRDisposeReference                (HRReference             hrRef);
  98.  
  99.  
  100. EXTERN_API( SInt32 )
  101. HRFreeMemory                    (Size                     inBytesNeeded);
  102.  
  103.  
  104. /* System level notifications */
  105. EXTERN_API( void )
  106. HRScreenConfigurationChanged    (void);
  107.  
  108. EXTERN_API( Boolean )
  109. HRIsHREvent                        (const EventRecord *    eventRecord);
  110.  
  111.  
  112. /* Drawing */
  113. EXTERN_API( OSStatus )
  114. HRSetGrafPtr                    (HRReference             hrRef,
  115.                                  GrafPtr                 grafPtr);
  116.  
  117. EXTERN_API( OSStatus )
  118. HRActivate                        (HRReference             hrRef);
  119.  
  120. EXTERN_API( OSStatus )
  121. HRDeactivate                    (HRReference             hrRef);
  122.  
  123. EXTERN_API( OSStatus )
  124. HRDraw                            (HRReference             hrRef,
  125.                                  RgnHandle                 updateRgnH);
  126.  
  127. EXTERN_API( OSStatus )
  128. HRSetRenderingRect                (HRReference             hrRef,
  129.                                  const Rect *            renderingRect);
  130.  
  131. EXTERN_API( OSStatus )
  132. HRGetRenderedImageSize            (HRReference             hrRef,
  133.                                  Point *                renderingSize);
  134.  
  135. EXTERN_API( OSStatus )
  136. HRScrollToLocation                (HRReference             hrRef,
  137.                                  Point *                location);
  138.  
  139. EXTERN_API( OSStatus )
  140. HRForceQuickdraw                (HRReference             hrRef,
  141.                                  Boolean                 forceQuickdraw);
  142.  
  143.  
  144. typedef SInt16 HRScrollbarState;
  145. enum {
  146.     eHRScrollbarOn                = 0,
  147.     eHRScrollbarOff                = 1,
  148.     eHRScrollbarAuto            = 2
  149. };
  150.  
  151. EXTERN_API( OSStatus )
  152. HRSetScrollbarState                (HRReference             hrRef,
  153.                                  HRScrollbarState         hScrollbarState,
  154.                                  HRScrollbarState         vScrollbarState);
  155.  
  156. EXTERN_API( OSStatus )
  157. HRSetDrawBorder                    (HRReference             hrRef,
  158.                                  Boolean                 drawBorder);
  159.  
  160. EXTERN_API( OSStatus )
  161. HRSetGrowboxCutout                (HRReference             hrRef,
  162.                                  Boolean                 allowCutout);
  163.  
  164. /* Navigation */
  165. EXTERN_API( OSStatus )
  166. HRGoToFile                        (HRReference             hrRef,
  167.                                  const FSSpec *            fsspec,
  168.                                  Boolean                 addToHistory,
  169.                                  Boolean                 forceRefresh);
  170.  
  171. EXTERN_API( OSStatus )
  172. HRGoToURL                        (HRReference             hrRef,
  173.                                  const char *            url,
  174.                                  Boolean                 addToHistory,
  175.                                  Boolean                 forceRefresh);
  176.  
  177. EXTERN_API( OSStatus )
  178. HRGoToAnchor                    (HRReference             hrRef,
  179.                                  const char *            anchorName);
  180.  
  181. EXTERN_API( OSStatus )
  182. HRGoToPtr                        (HRReference             hrRef,
  183.                                  char *                    buffer,
  184.                                  UInt32                 bufferSize,
  185.                                  Boolean                 addToHistory,
  186.                                  Boolean                 forceRefresh);
  187.  
  188. /* Accessors */
  189. /* either file url or url of <base> tag */
  190. EXTERN_API( OSStatus )
  191. HRGetRootURL                    (HRReference             hrRef,
  192.                                  Handle                 rootURLH);
  193.  
  194. /* url of <base> tag */
  195. EXTERN_API( OSStatus )
  196. HRGetBaseURL                    (HRReference             hrRef,
  197.                                  Handle                 baseURLH);
  198.  
  199. /* file url */
  200. EXTERN_API( OSStatus )
  201. HRGetHTMLURL                    (HRReference             hrRef,
  202.                                  Handle                 HTMLURLH);
  203.  
  204. EXTERN_API( OSStatus )
  205. HRGetTitle                        (HRReference             hrRef,
  206.                                  StringPtr                 title);
  207.  
  208. EXTERN_API( OSStatus )
  209. HRGetHTMLFile                    (HRReference             hrRef,
  210.                                  FSSpec *                fsspec);
  211.  
  212.  
  213. /* Utilities */
  214. EXTERN_API( OSStatus )
  215. HRUtilCreateFullURL                (const char *            rootURL,
  216.                                  const char *            linkURL,
  217.                                  Handle                 fullURLH);
  218.  
  219. EXTERN_API( OSStatus )
  220. HRUtilGetFSSpecFromURL            (const char *            rootURL,
  221.                                  const char *            linkURL,
  222.                                  FSSpec *                destSpec);
  223.  
  224. /* urlHandle should be valid on input */
  225. EXTERN_API( OSStatus )
  226. HRUtilGetURLFromFSSpec            (const FSSpec *            fsspec,
  227.                                  Handle                 urlHandle);
  228.  
  229. /*
  230.     Visited links
  231.  
  232.     If you register a function here, it will be called to determine
  233.     whether or not the given URL has been visited. It should return
  234.     true if the URL has been visited.
  235.     
  236.     In addition to the URLs that the application may add to the list
  237.     of visited links, it should also add URLs that the user clicks
  238.     on. These URLs can be caught by the "add URL to history" callback
  239.     below.
  240.  */
  241. typedef CALLBACK_API( Boolean , HRWasURLVisitedProcPtr )(const char *url, void *refCon);
  242. typedef STACK_UPP_TYPE(HRWasURLVisitedProcPtr)                     HRWasURLVisitedUPP;
  243. EXTERN_API( void )
  244. HRRegisterWasURLVisitedUPP        (HRWasURLVisitedUPP     inWasURLVisitedUPP,
  245.                                  HRReference             hrRef,
  246.                                  void *                    inRefCon);
  247.  
  248. EXTERN_API( void )
  249. HRUnregisterWasURLVisitedUPP    (HRReference             hrRef);
  250.  
  251.  
  252.  
  253. /*
  254.     New URL
  255.  
  256.     If you register a function here, it will be called every time
  257.     the renderer is going to display a new URL. A few examples of how
  258.     you might use this include...
  259.     
  260.         (a) maintaining a history of URLs
  261.         (b) maintainging a list of visited links
  262.         (c) setting a window title based on the new URL
  263. */
  264. typedef CALLBACK_API( OSStatus , HRNewURLProcPtr )(const char *url, const char *targetFrame, Boolean addToHistory, void *refCon);
  265. typedef STACK_UPP_TYPE(HRNewURLProcPtr)                         HRNewURLUPP;
  266. EXTERN_API( void )
  267. HRRegisterNewURLUPP                (HRNewURLUPP             inNewURLUPP,
  268.                                  HRReference             hrRef,
  269.                                  void *                    inRefCon);
  270.  
  271. EXTERN_API( void )
  272. HRUnregisterNewURLUPP            (HRReference             hrRef);
  273.  
  274.  
  275.  
  276.  
  277. /*
  278.     URL to FSSpec function
  279.  
  280.     If you register a function here, it will be called every time
  281.     the renderer is going to locate a file. The function will be
  282.     passed an enum indicating the type of file being asked for.
  283.  */
  284.  
  285. typedef UInt16 URLSourceType;
  286. enum {
  287.     kHRLookingForHTMLSource        = 1,
  288.     kHRLookingForImage            = 2,
  289.     kHRLookingForEmbedded        = 3,
  290.     kHRLookingForImageMap        = 4,
  291.     kHRLookingForFrame            = 5
  292. };
  293.  
  294. typedef CALLBACK_API( OSStatus , HRURLToFSSpecProcPtr )(const char *rootURL, const char *linkURL, FSSpec *fsspec, URLSourceType urlSourceType, void *refCon);
  295. typedef STACK_UPP_TYPE(HRURLToFSSpecProcPtr)                     HRURLToFSSpecUPP;
  296. EXTERN_API( void )
  297. HRRegisterURLToFSSpecUPP        (HRURLToFSSpecUPP         inURLToFSSpecUPP,
  298.                                  HRReference             hrRef,
  299.                                  void *                    inRefCon);
  300.  
  301. EXTERN_API( void )
  302. HRUnregisterURLToFSSpecUPP        (HRReference             hrRef);
  303.  
  304.  
  305.  
  306. #if OPAQUE_UPP_TYPES
  307.     EXTERN_API(HRWasURLVisitedUPP)
  308.     NewHRWasURLVisitedUPP           (HRWasURLVisitedProcPtr    userRoutine);
  309.  
  310.     EXTERN_API(HRNewURLUPP)
  311.     NewHRNewURLUPP                   (HRNewURLProcPtr            userRoutine);
  312.  
  313.     EXTERN_API(HRURLToFSSpecUPP)
  314.     NewHRURLToFSSpecUPP               (HRURLToFSSpecProcPtr    userRoutine);
  315.  
  316.     EXTERN_API(void)
  317.     DisposeHRWasURLVisitedUPP       (HRWasURLVisitedUPP        userUPP);
  318.  
  319.     EXTERN_API(void)
  320.     DisposeHRNewURLUPP               (HRNewURLUPP                userUPP);
  321.  
  322.     EXTERN_API(void)
  323.     DisposeHRURLToFSSpecUPP           (HRURLToFSSpecUPP        userUPP);
  324.  
  325.     EXTERN_API(Boolean)
  326.     InvokeHRWasURLVisitedUPP       (const char *            url,
  327.                                     void *                    refCon,
  328.                                     HRWasURLVisitedUPP        userUPP);
  329.  
  330.     EXTERN_API(OSStatus)
  331.     InvokeHRNewURLUPP               (const char *            url,
  332.                                     const char *            targetFrame,
  333.                                     Boolean                    addToHistory,
  334.                                     void *                    refCon,
  335.                                     HRNewURLUPP                userUPP);
  336.  
  337.     EXTERN_API(OSStatus)
  338.     InvokeHRURLToFSSpecUPP           (const char *            rootURL,
  339.                                     const char *            linkURL,
  340.                                     FSSpec *                fsspec,
  341.                                     URLSourceType            urlSourceType,
  342.                                     void *                    refCon,
  343.                                     HRURLToFSSpecUPP        userUPP);
  344.  
  345. #else
  346.     enum { uppHRWasURLVisitedProcInfo = 0x000003D0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes) */
  347.     enum { uppHRNewURLProcInfo = 0x000037F0 };                         /* pascal 4_bytes Func(4_bytes, 4_bytes, 1_byte, 4_bytes) */
  348.     enum { uppHRURLToFSSpecProcInfo = 0x0000EFF0 };                 /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 2_bytes, 4_bytes) */
  349.     #define NewHRWasURLVisitedUPP(userRoutine)                         (HRWasURLVisitedUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHRWasURLVisitedProcInfo, GetCurrentArchitecture())
  350.     #define NewHRNewURLUPP(userRoutine)                             (HRNewURLUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHRNewURLProcInfo, GetCurrentArchitecture())
  351.     #define NewHRURLToFSSpecUPP(userRoutine)                         (HRURLToFSSpecUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHRURLToFSSpecProcInfo, GetCurrentArchitecture())
  352.     #define DisposeHRWasURLVisitedUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  353.     #define DisposeHRNewURLUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  354.     #define DisposeHRURLToFSSpecUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  355.     #define InvokeHRWasURLVisitedUPP(url, refCon, userUPP)             (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppHRWasURLVisitedProcInfo, (url), (refCon))
  356.     #define InvokeHRNewURLUPP(url, targetFrame, addToHistory, refCon, userUPP)  (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppHRNewURLProcInfo, (url), (targetFrame), (addToHistory), (refCon))
  357.     #define InvokeHRURLToFSSpecUPP(rootURL, linkURL, fsspec, urlSourceType, refCon, userUPP)  (OSStatus)CALL_FIVE_PARAMETER_UPP((userUPP), uppHRURLToFSSpecProcInfo, (rootURL), (linkURL), (fsspec), (urlSourceType), (refCon))
  358. #endif
  359. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  360. #define NewHRWasURLVisitedProc(userRoutine)                     NewHRWasURLVisitedUPP(userRoutine)
  361. #define NewHRNewURLProc(userRoutine)                             NewHRNewURLUPP(userRoutine)
  362. #define NewHRURLToFSSpecProc(userRoutine)                         NewHRURLToFSSpecUPP(userRoutine)
  363. #define CallHRWasURLVisitedProc(userRoutine, url, refCon)        InvokeHRWasURLVisitedUPP(url, refCon, userRoutine)
  364. #define CallHRNewURLProc(userRoutine, url, targetFrame, addToHistory, refCon) InvokeHRNewURLUPP(url, targetFrame, addToHistory, refCon, userRoutine)
  365. #define CallHRURLToFSSpecProc(userRoutine, rootURL, linkURL, fsspec, urlSourceType, refCon) InvokeHRURLToFSSpecUPP(rootURL, linkURL, fsspec, urlSourceType, refCon, userRoutine)
  366.  
  367. #if PRAGMA_STRUCT_ALIGN
  368.     #pragma options align=reset
  369. #elif PRAGMA_STRUCT_PACKPUSH
  370.     #pragma pack(pop)
  371. #elif PRAGMA_STRUCT_PACK
  372.     #pragma pack()
  373. #endif
  374.  
  375. #ifdef PRAGMA_IMPORT_OFF
  376. #pragma import off
  377. #elif PRAGMA_IMPORT
  378. #pragma import reset
  379. #endif
  380.  
  381. #ifdef __cplusplus
  382. }
  383. #endif
  384.  
  385. #endif /* __HTMLRENDERING__ */
  386.  
  387.